/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * TransformingNodeInspector.java
 *
 * Created on 2011/2/12, 下午 10:07:47
 */

package elaborate.h2x.tester;

import elaborate.h2x.parser.TransformingModelParserBuilder;
import elaborate.h2x.parser.TransformingModelParserBuilderFactory;
import elaborate.h2x.transform.TransformingModel;
import java.io.File;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;

/**
 *
 * @author lendle
 */
public class TransformingNodeInspector extends javax.swing.JFrame {

    /** Creates new form TransformingNodeInspector */
    public TransformingNodeInspector() {
        initComponents();
        this.setSize(800, 600);
    }

    public TransformingNodeInspectorPanel getTransformingNodeInspectorPanel() {
        return transformingNodeInspectorPanel;
    }


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        transformingNodeInspectorPanel = new elaborate.h2x.tester.TransformingNodeInspectorPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBounds(new java.awt.Rectangle(0, 0, 800, 600));
        getContentPane().add(transformingNodeInspectorPanel, java.awt.BorderLayout.CENTER);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) throws Exception{
        final TransformingNodeInspector inspector=new TransformingNodeInspector();
        TransformingModelParserBuilderFactory tmf=TransformingModelParserBuilderFactory.newInstance();
        TransformingModelParserBuilder tmb=tmf.newTransformingModelParserBuilder();

        DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
        dbf.setNamespaceAware(true);
        DocumentBuilder db=dbf.newDocumentBuilder();
        Document doc=db.parse(new File("src\\example1.xhtml"));

        TransformingModel model=tmb.newTransformingModelParser().parse(doc);

        inspector.getTransformingNodeInspectorPanel().setTransformingModel(model);

        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                inspector.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private elaborate.h2x.tester.TransformingNodeInspectorPanel transformingNodeInspectorPanel;
    // End of variables declaration//GEN-END:variables

}
